/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * VisualTestOne.java
 *
 * Created on Jul 31, 2011, 6:03:23 PM
 */

package IDSNN_1_Interface;

import IDSNN_1_Business.TcpDump;
import IDSNN_1_Data.Convert;
import IDSNN_1_Data.Ficheiro;
import ISDSNN_1_DSC.MyThread;
import java.util.ArrayList;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JOptionPane;

/**
 *
 * @author francisco
 */
public class VisualTestOne extends javax.swing.JFrame {

    private TestInterface ti;
    private Ficheiro file;
    private ArrayList<String> internal;
    private ArrayList<String> snort;
    private JFrame frame;
    private SnortInterface sn;
    private Convert cv;
    
    
    /** Creates new form VisualTestOne */
    public VisualTestOne() {
        initComponents();
        
        JOptionPane.showMessageDialog(this,"Remmember. You need to run this app in admin mode.");
        internal = new ArrayList<String>();
        snort = new ArrayList<String>();
        file = new Ficheiro();
        try{
        file.buscarPalavras("internal.in", 0);
        }
        catch(Exception ex){
           ex.printStackTrace();
           JOptionPane.showMessageDialog(this,"Something went wrong. Please verify the \"internal.in\" file...");
        }
        internal = (ArrayList<String>) file.getLista().clone();
        file.clearDic();
        try{
        file.buscarPalavras("snort.in", 0);
        }
        catch(Exception ex){
           ex.printStackTrace();
           JOptionPane.showMessageDialog(this,"Something went wrong. Please verify the \"snort.in\" file...");
        }
        snort = file.getLista();
        if(internal.get(3).equals("nnn"))
            internal.set(3,"");
        if(snort.get(2).equals("nnn"))
            snort.set(2,"");
        sn = new SnortInterface(_snortReportTextBox,snort.get(0),snort.get(1),snort.get(2),snort.get(3),internal, _reportTextBox);
        ti = new TestInterface(_reportTextBox,internal.get(0), internal.get(2), internal.get(3),internal.get(5));
    }

    
    
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        _urlTestTextBox = new javax.swing.JTextField();
        _userTestTextBox = new javax.swing.JTextField();
        Reports = new javax.swing.JTabbedPane();
        jPanel4 = new javax.swing.JPanel();
        jScrollPane1 = new javax.swing.JScrollPane();
        _reportTextBox = new javax.swing.JTextArea();
        jScrollPane2 = new javax.swing.JScrollPane();
        _trafficTextBox = new javax.swing.JTextArea();
        jLabel3 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jPanel5 = new javax.swing.JPanel();
        jScrollPane3 = new javax.swing.JScrollPane();
        _snortReportTextBox = new javax.swing.JTextArea();
        _passTestTextBox = new javax.swing.JTextField();
        jTabbedPane1 = new javax.swing.JTabbedPane();
        Menu = new javax.swing.JTabbedPane();
        jPanel6 = new javax.swing.JPanel();
        jPanel1 = new javax.swing.JPanel();
        MyThread = new javax.swing.JButton();
        jLabel1 = new javax.swing.JLabel();
        trainNN = new javax.swing.JButton();
        jPanel2 = new javax.swing.JPanel();
        execute = new javax.swing.JButton();
        TCPDump = new javax.swing.JButton();
        jLabel2 = new javax.swing.JLabel();
        jPanel3 = new javax.swing.JPanel();
        _execute = new javax.swing.JButton();
        jPanel7 = new javax.swing.JPanel();
        executeSnort = new javax.swing.JButton();
        _createTranSetSnortButton = new javax.swing.JButton();
        _exportICMPButton = new javax.swing.JButton();
        _exportFlagsButton1 = new javax.swing.JButton();
        _exportIniButton = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setName("_MainFrame"); // NOI18N
        addComponentListener(new java.awt.event.ComponentAdapter() {
            public void componentResized(java.awt.event.ComponentEvent evt) {
                _resizeTextBox(evt);
            }
        });

        _urlTestTextBox.setText("89.155.7.151:3306");

        _userTestTextBox.setText("root");

        _reportTextBox.setColumns(20);
        _reportTextBox.setRows(5);
        jScrollPane1.setViewportView(_reportTextBox);

        _trafficTextBox.setColumns(20);
        _trafficTextBox.setRows(5);
        jScrollPane2.setViewportView(_trafficTextBox);

        jLabel3.setFont(new java.awt.Font("Lucida Grande", 1, 14));
        jLabel3.setForeground(new java.awt.Color(204, 0, 51));
        jLabel3.setText("Scan Detection");

        jLabel4.setFont(new java.awt.Font("Lucida Grande", 1, 14));
        jLabel4.setForeground(new java.awt.Color(204, 0, 51));
        jLabel4.setText("Traffic");

        org.jdesktop.layout.GroupLayout jPanel4Layout = new org.jdesktop.layout.GroupLayout(jPanel4);
        jPanel4.setLayout(jPanel4Layout);
        jPanel4Layout.setHorizontalGroup(
            jPanel4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel4Layout.createSequentialGroup()
                .addContainerGap()
                .add(jPanel4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(jScrollPane2, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 837, Short.MAX_VALUE)
                    .add(jScrollPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 837, Short.MAX_VALUE)
                    .add(jLabel3)
                    .add(jLabel4))
                .addContainerGap())
        );
        jPanel4Layout.setVerticalGroup(
            jPanel4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(org.jdesktop.layout.GroupLayout.TRAILING, jPanel4Layout.createSequentialGroup()
                .addContainerGap()
                .add(jLabel3)
                .add(5, 5, 5)
                .add(jScrollPane1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 233, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 25, Short.MAX_VALUE)
                .add(jLabel4)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jScrollPane2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 295, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );

        Reports.addTab("IDSNN Report", jPanel4);

        _snortReportTextBox.setColumns(20);
        _snortReportTextBox.setRows(5);
        jScrollPane3.setViewportView(_snortReportTextBox);

        org.jdesktop.layout.GroupLayout jPanel5Layout = new org.jdesktop.layout.GroupLayout(jPanel5);
        jPanel5.setLayout(jPanel5Layout);
        jPanel5Layout.setHorizontalGroup(
            jPanel5Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(0, 877, Short.MAX_VALUE)
            .add(jPanel5Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                .add(jPanel5Layout.createSequentialGroup()
                    .add(20, 20, 20)
                    .add(jScrollPane3, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 837, Short.MAX_VALUE)
                    .add(20, 20, 20)))
        );
        jPanel5Layout.setVerticalGroup(
            jPanel5Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(0, 640, Short.MAX_VALUE)
            .add(jPanel5Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                .add(jPanel5Layout.createSequentialGroup()
                    .add(203, 203, 203)
                    .add(jScrollPane3, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 233, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .addContainerGap(204, Short.MAX_VALUE)))
        );

        Reports.addTab("Snort Report", jPanel5);

        _passTestTextBox.setText("rootmegatek");

        jPanel1.setBackground(new java.awt.Color(51, 51, 255));

        MyThread.setText("Perform Multiple Scan");
        MyThread.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                MyThreadActionPerformed(evt);
            }
        });

        jLabel1.setForeground(new java.awt.Color(255, 255, 255));
        jLabel1.setText("Preparing system");

        trainNN.setText("Train Neural Network");
        trainNN.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                trainNNActionPerformed(evt);
            }
        });

        org.jdesktop.layout.GroupLayout jPanel1Layout = new org.jdesktop.layout.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(jLabel1)
                    .add(org.jdesktop.layout.GroupLayout.TRAILING, trainNN, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 194, Short.MAX_VALUE)
                    .add(MyThread, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 194, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .addContainerGap())
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(org.jdesktop.layout.GroupLayout.TRAILING, jPanel1Layout.createSequentialGroup()
                .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .add(jLabel1)
                .add(14, 14, 14)
                .add(trainNN)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(MyThread)
                .addContainerGap())
        );

        jPanel2.setBackground(new java.awt.Color(51, 102, 255));

        execute.setText("Execute");
        execute.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                executeActionPerformed(evt);
            }
        });

        TCPDump.setText("Capture Data");
        TCPDump.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                TCPDumpActionPerformed(evt);
            }
        });

        jLabel2.setForeground(new java.awt.Color(255, 255, 255));
        jLabel2.setText("Start Detection");

        org.jdesktop.layout.GroupLayout jPanel2Layout = new org.jdesktop.layout.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING, false)
                        .add(org.jdesktop.layout.GroupLayout.LEADING, TCPDump, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .add(org.jdesktop.layout.GroupLayout.LEADING, execute, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 191, Short.MAX_VALUE))
                    .add(jLabel2))
                .addContainerGap(20, Short.MAX_VALUE))
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel2Layout.createSequentialGroup()
                .add(20, 20, 20)
                .add(jLabel2)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                .add(execute)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                .add(TCPDump)
                .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jPanel3.setBackground(new java.awt.Color(102, 204, 255));

        _execute.setText("Create DataSet File");
        _execute.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                _executeActionPerformed(evt);
            }
        });

        org.jdesktop.layout.GroupLayout jPanel3Layout = new org.jdesktop.layout.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .add(_execute, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 191, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(23, Short.MAX_VALUE))
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .add(_execute)
                .addContainerGap(39, Short.MAX_VALUE))
        );

        org.jdesktop.layout.GroupLayout jPanel6Layout = new org.jdesktop.layout.GroupLayout(jPanel6);
        jPanel6.setLayout(jPanel6Layout);
        jPanel6Layout.setHorizontalGroup(
            jPanel6Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel6Layout.createSequentialGroup()
                .addContainerGap()
                .add(jPanel6Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING, false)
                    .add(org.jdesktop.layout.GroupLayout.LEADING, jPanel3, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .add(org.jdesktop.layout.GroupLayout.LEADING, jPanel2, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .add(org.jdesktop.layout.GroupLayout.LEADING, jPanel1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap(37, Short.MAX_VALUE))
        );
        jPanel6Layout.setVerticalGroup(
            jPanel6Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel6Layout.createSequentialGroup()
                .addContainerGap()
                .add(jPanel1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                .add(jPanel2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 108, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .add(18, 18, 18)
                .add(jPanel3, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(44, Short.MAX_VALUE))
        );

        Menu.addTab("IDSNN", jPanel6);

        executeSnort.setText("Start");
        executeSnort.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                executeSnortActionPerformed(evt);
            }
        });

        _createTranSetSnortButton.setText("Create TrainSet");
        _createTranSetSnortButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                _createTranSetSnortButtonActionPerformed(evt);
            }
        });

        _exportICMPButton.setText("Export ICMP");
        _exportICMPButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                _exportICMPButtonActionPerformed(evt);
            }
        });

        _exportFlagsButton1.setText("Export Flags");
        _exportFlagsButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                _exportFlagsButton1ActionPerformed(evt);
            }
        });

        _exportIniButton.setText("Initialize Export");
        _exportIniButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                _exportIniButtonActionPerformed(evt);
            }
        });

        org.jdesktop.layout.GroupLayout jPanel7Layout = new org.jdesktop.layout.GroupLayout(jPanel7);
        jPanel7.setLayout(jPanel7Layout);
        jPanel7Layout.setHorizontalGroup(
            jPanel7Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel7Layout.createSequentialGroup()
                .add(17, 17, 17)
                .add(executeSnort, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 254, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
            .add(org.jdesktop.layout.GroupLayout.TRAILING, jPanel7Layout.createSequentialGroup()
                .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .add(_createTranSetSnortButton, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 254, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
            .add(jPanel7Layout.createSequentialGroup()
                .addContainerGap()
                .add(_exportFlagsButton1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 254, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
            .add(jPanel7Layout.createSequentialGroup()
                .addContainerGap()
                .add(_exportICMPButton, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 254, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
            .add(jPanel7Layout.createSequentialGroup()
                .addContainerGap()
                .add(_exportIniButton, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 254, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        jPanel7Layout.setVerticalGroup(
            jPanel7Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel7Layout.createSequentialGroup()
                .addContainerGap()
                .add(executeSnort)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(_createTranSetSnortButton)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(_exportIniButton)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                .add(_exportFlagsButton1)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(_exportICMPButton)
                .addContainerGap(244, Short.MAX_VALUE))
        );

        Menu.addTab("Snort", jPanel7);

        org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(layout.createSequentialGroup()
                .addContainerGap()
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(_passTestTextBox, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(layout.createSequentialGroup()
                        .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                            .add(layout.createSequentialGroup()
                                .add(250, 250, 250)
                                .add(jTabbedPane1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                            .add(Menu, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                        .add(18, 18, 18)
                        .add(Reports, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 898, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                    .add(layout.createSequentialGroup()
                        .add(_urlTestTextBox, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                        .add(1, 1, 1)
                        .add(_userTestTextBox, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(layout.createSequentialGroup()
                .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(_urlTestTextBox, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(_userTestTextBox, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(_passTestTextBox, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .add(66, 66, 66)
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(Reports, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 686, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(layout.createSequentialGroup()
                        .add(Menu, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                        .add(226, 226, 226)
                        .add(jTabbedPane1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

  public void ShowDialogBox(){
  frame = new JFrame("Show Message Dialog");
  JButton button = new JButton("Click Me");
  button.addActionListener(new MyAction(frame));
  frame.add(button);
  frame.setSize(400, 400);
  frame.setVisible(true);
  frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  }
    
    private void _executeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event__executeActionPerformed

    ti.writeFile();
    }//GEN-LAST:event__executeActionPerformed
    
private void executeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_executeActionPerformed
    ti.execute();
}//GEN-LAST:event_executeActionPerformed

private void trainNNActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_trainNNActionPerformed
    JOptionPane.showMessageDialog(this,"Trainning Neural Network. Please be patient.\nA confirmation message will appear when done.");
    
    ti.trainNN();
    JOptionPane.showMessageDialog(this,"Neural network successfully trained.");
}//GEN-LAST:event_trainNNActionPerformed

private void MyThreadActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_MyThreadActionPerformed
    MyThread  mt = new MyThread();
    mt.setFileDir(internal.get(4));
    mt.main();// TODO add your handling code here:
}//GEN-LAST:event_MyThreadActionPerformed

private void TCPDumpActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_TCPDumpActionPerformed
    TcpDump tcpd = new TcpDump(_trafficTextBox, internal.get(1), internal.get(2),internal.get(3),internal.get(0), internal.get(5));
    /*tcpd.setPass(internal.get(2));
    tcpd.setUser(internal.get(3));
    tcpd.setURL(internal.get(5));*/
    tcpd.main();// TODO add your handling code here:
}//GEN-LAST:event_TCPDumpActionPerformed

private void _resizeTextBox(java.awt.event.ComponentEvent evt) {//GEN-FIRST:event__resizeTextBox
// TODO add your handling code here:
}//GEN-LAST:event__resizeTextBox

private void executeSnortActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_executeSnortActionPerformed

JOptionPane.showMessageDialog(this,"Trainning Neural Network. Please be patient.\nA confirmation message will appear when done.");
sn.trainNN();
JOptionPane.showMessageDialog(this,"Neural network successfully trained.");
sn.execute();
}//GEN-LAST:event_executeSnortActionPerformed

private void _createTranSetSnortButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event__createTranSetSnortButtonActionPerformed
sn.writeFile();// TODO add your handling code here:
}//GEN-LAST:event__createTranSetSnortButtonActionPerformed

private void _exportICMPButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event__exportICMPButtonActionPerformed
cv.startImportICMP();
// TODO add your handling code here:
}//GEN-LAST:event__exportICMPButtonActionPerformed

private void _exportFlagsButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event__exportFlagsButton1ActionPerformed
cv.startImportNotICMP();
}//GEN-LAST:event__exportFlagsButton1ActionPerformed

private void _exportIniButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event__exportIniButtonActionPerformed
cv = new Convert(internal.get(2), internal.get(3), internal.get(5), internal.get(0), snort.get(1), snort.get(2), snort.get(0), snort.get(3));
}//GEN-LAST:event__exportIniButtonActionPerformed

    /**
    * @param args the command line arguments
    */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new VisualTestOne().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JTabbedPane Menu;
    private javax.swing.JButton MyThread;
    private javax.swing.JTabbedPane Reports;
    private javax.swing.JButton TCPDump;
    private javax.swing.JButton _createTranSetSnortButton;
    private javax.swing.JButton _execute;
    private javax.swing.JButton _exportFlagsButton1;
    private javax.swing.JButton _exportICMPButton;
    private javax.swing.JButton _exportIniButton;
    private javax.swing.JTextField _passTestTextBox;
    private javax.swing.JTextArea _reportTextBox;
    private javax.swing.JTextArea _snortReportTextBox;
    private javax.swing.JTextArea _trafficTextBox;
    private javax.swing.JTextField _urlTestTextBox;
    private javax.swing.JTextField _userTestTextBox;
    private javax.swing.JButton execute;
    private javax.swing.JButton executeSnort;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JPanel jPanel5;
    private javax.swing.JPanel jPanel6;
    private javax.swing.JPanel jPanel7;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JScrollPane jScrollPane3;
    private javax.swing.JTabbedPane jTabbedPane1;
    private javax.swing.JButton trainNN;
    // End of variables declaration//GEN-END:variables

}
